/**
 * @description 有面值为1、3、5的硬币，怎么样用最少数量的硬币凑够11元？
 * @param val 
 * @returns 
 */
export default function coin(val: number): number[] {
    const coins: number[] = [5, 3, 1];
    const res: number[] = [];
    let curVal: number = val;
    while (curVal > 0) {
        for (const ci of coins) {
            if (curVal >= ci) {
                res.push(ci);
                curVal -= ci;
                break;
            }
        }
    }
    return res;
}